<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>code 2 comment</title>
  </head>

  <body>
    <div id="app">
      <textarea id="code" cols="100" rows="20"></textarea>
      <textarea id="comment" cols="100" rows="20"></textarea>
      <button id="transform">transform</button>
    </div>
    <script>
      const transform = document.getElementById('transform')
      const code = document.getElementById('code')
      const comment = document.getElementById('comment')
      transform.onclick = () => {
        comment.value = t(code.value)
      }
      function t(src) {
        const lines = src.split('\n').map((line) => '* ' + line.replace('../src/', 'fp-ts/'))
        return '*\n* @example\n' + lines.join('\n') + '\n'
      }
    </script>
  </body>
</html>
